home *** CD-ROM | disk | FTP | other *** search
- /*
- * FILE: simpict.c
- * AUTHOR: R. Gonzalez
- * CREATED: October 4, 1990
- *
- * Test simple pict application. Includes main() function.
- *
- * ASSOCIATED FILES:
- * simpict.h,class.c,class.h,screen.c,screen.h,coord.c,coord.h,
- * frame.c,frame.h,color.h,error.c,error.h,trans.h,oops.h,
- * pict.c,pict.h,project.c,project.h,backdrop.c,backdrop.h,
- * several ANSI and Macintosh headers
- *
- * PROJECT CONTENTS (Think C):
- * above-listed source (.c) files, MacTraps, ANSI or ANSI-881,
- * oops library.
- *
- * COMPILATION (Think C):
- * 68881 code generation if ANSI-881 is used.
- */
-
- # include "simpict.h"
-
- /******************************************************************
- * initialize
- ******************************************************************/
- boolean Simple_Pict::init(void)
- {
- Generic_Pict::init();
-
- projector1 = new(Projector);
- projector1->init();
- projector1->set_cropping_frame(5.,5.,10.,10.);
- projector1->set_projection_frame(0.,0.,1.,1.);
- projector1->set_background_color(CYAN);
- projector1->set_screen(screen);
-
- projector2 = new(Corner_Projector);
- projector2->init();
- projector2->set_cropping_frame(5.,5.,10.,10.);
- projector2->set_screen(screen);
-
- c1 = new(Coord2);
- c1->init();
- c2 = new(Coord2);
- c2->init();
-
- return TRUE;
- }
-
- /******************************************************************
- * run
- ******************************************************************/
- void Simple_Pict::run(void)
- {
- c1->set(1.,1.);
- c2->set(9.,9.);
-
- projector1->show_line(c1,c2,RED);
- projector2->show_line(c1,c2,BLUE);
-
- screen->wait();
- }
-
- /******************************************************************
- * destroy
- ******************************************************************/
- boolean Simple_Pict::destroy(void)
- {
- c1->destroy();
- delete(c1);
- c2->destroy();
- delete(c2);
-
- projector1->destroy();
- delete(projector1);
- projector2->destroy();
- delete(projector2);
-
- return Generic_Pict::destroy();
- }
-
- /******************************************************************
- * main function
- ******************************************************************/
- main()
- {
- Generic_Pict *pict;
-
- pict = new(Simple_Pict);
- pict->init();
- pict->run();
- pict->destroy();
- delete(pict);
- }
-
-
-